{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from spacetimeengine import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from galgebra.printer import Format, GaLatexPrinter\n",
    "\n",
    "Format()\n",
    "from galgebra.ga import Ga\n",
    "from galgebra.mv import ONE, ZERO, HALF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.display import display, Math\n",
    "\n",
    "def show(x):\n",
    "    if isinstance(x, list):\n",
    "         for item in x:\n",
    "            display(Math(GaLatexPrinter.latex(item)))\n",
    "    else:\n",
    "        display(Math(GaLatexPrinter.latex(x)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def build_ga_from_solution(solution, norm=False):\n",
    "    [metric, coordinate_set, _index_config, cosmological_constant] = solution\n",
    "    return Ga('', g=metric, coords=coordinate_set, norm=norm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def dot_basis_r_basis(ga):\n",
    "    return [ga.dot(ga.basis[i], ga.r_basis[i]) for i in ga.n_range]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def gg(ga):\n",
    "    return simplify(ga.g * ga.g_inv)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def conv_christoffel_symbols(cf):\n",
    "    return permutedims(Array(cf), (2, 0, 1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def show_christoffel_symbols(ga):\n",
    "    if ga.connect_flg:\n",
    "        display(conv_christoffel_symbols(ga.Christoffel_symbols(mode=1)))\n",
    "        display(conv_christoffel_symbols(ga.Christoffel_symbols(mode=2)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Minkowski Spacetime Metric"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "minkowski = build_ga_from_solution(Solution().minkowski())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_t}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_x}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_y}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_z}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(minkowski.mv())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' \\\\left [ \\\\begin{array}{cccc} 1 & 0 & 0 & 0  \\\\\\\\ 0 & -1 & 0 & 0  \\\\\\\\ 0 & 0 & -1 & 0  \\\\\\\\ 0 & 0 & 0 & -1  \\\\end{array}\\\\right ] '"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & -1 & 0 & 0\\\\0 & 0 & -1 & 0\\\\0 & 0 & 0 & -1\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "None"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "minkowski.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$-1$$"
      ],
      "text/plain": [
       "-1"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "minkowski.e_sq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left [ 1, \\quad 1, \\quad 1, \\quad 1\\right ]$$"
      ],
      "text/plain": [
       "[1, 1, 1, 1]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(minkowski)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(minkowski)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Kerr-Debney Metric\n",
    "\n",
    "$$\n",
    "g=\\left[ \\begin{array}{cccc}{0} & {0} & {-e^{-z}} & {0} \\\\ {0} & {\\frac{u^{2} e^{4 z}}{2}} & {0} & {0} \\\\ {-e^{-z}} & {0} & {12 e^{-2 z}} & {u e^{-z}} \\\\ {0} & {0} & {u e^{-z}} & {\\frac{u^{2}}{2}}\\end{array}\\right]\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "g4coords = (u, x, y, z) = symbols(\"u x y z\")\n",
    "g = [\n",
    "    [0, 0, -exp(-z), 0],\n",
    "    [0, HALF * u ** 2 * exp(4 * z), 0, 0],\n",
    "    [-exp(-z), 0, 12 * exp(-2 * z), u * exp(-z)],\n",
    "    [0, 0, u * exp(-z), HALF * u ** 2],\n",
    "]\n",
    "g4 = build_ga_from_solution([g, g4coords, None, 0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_u}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_x}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_y}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_z}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(g4.mv())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' \\\\left [ \\\\begin{array}{cccc} 0 & 0 & - e^{- z} & 0  \\\\\\\\ 0 & \\\\frac{u^{2} e^{4 z}}{2} & 0 & 0  \\\\\\\\ - e^{- z} & 0 & 12 e^{- 2 z} & u e^{- z}  \\\\\\\\ 0 & 0 & u e^{- z} & \\\\frac{u^{2}}{2}  \\\\end{array}\\\\right ] '"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}0 & 0 & - e^{- z} & 0\\\\0 & \\frac{u^{2} e^{4 z}}{2} & 0 & 0\\\\- e^{- z} & 0 & 12 e^{- 2 z} & u e^{- z}\\\\0 & 0 & u e^{- z} & \\frac{u^{2}}{2}\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "None"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g4.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$- \\frac{u^{4} e^{2 z}}{4}$$"
      ],
      "text/plain": [
       "  4  2⋅z \n",
       "-u ⋅ℯ    \n",
       "─────────\n",
       "    4    "
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g4.e_sq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left [ - \\frac{u^{4} e^{2 z}}{4}, \\quad - \\frac{u^{4} e^{2 z}}{4}, \\quad - \\frac{u^{4} e^{2 z}}{4}, \\quad - \\frac{u^{4} e^{2 z}}{4}\\right ]$$"
      ],
      "text/plain": [
       "⎡  4  2⋅z     4  2⋅z     4  2⋅z     4  2⋅z ⎤\n",
       "⎢-u ⋅ℯ      -u ⋅ℯ      -u ⋅ℯ      -u ⋅ℯ    ⎥\n",
       "⎢─────────, ─────────, ─────────, ─────────⎥\n",
       "⎣    4          4          4          4    ⎦"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(g4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(g4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & - \\frac{u e^{4 z}}{2} & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & - \\frac{u}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & \\frac{u e^{4 z}}{2} & 0 & 0\\\\\\frac{u e^{4 z}}{2} & 0 & 0 & u^{2} e^{4 z}\\\\0 & 0 & 0 & 0\\\\0 & u^{2} e^{4 z} & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & e^{- z}\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & - 12 e^{- 2 z}\\\\e^{- z} & 0 & - 12 e^{- 2 z} & - u e^{- z}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & \\frac{u}{2}\\\\0 & - u^{2} e^{4 z} & 0 & 0\\\\0 & 0 & 12 e^{- 2 z} & 0\\\\\\frac{u}{2} & 0 & 0 & 0\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                       ⎡           4⋅z             ⎤                         \n",
       "⎢⎡0     0      0   0 ⎤  ⎢        u⋅ℯ                ⎥                         \n",
       "⎢⎢                   ⎥  ⎢  0     ──────   0     0   ⎥  ⎡                      \n",
       "⎢⎢       4⋅z         ⎥  ⎢          2                ⎥  ⎢ 0   0      0         \n",
       "⎢⎢   -u⋅ℯ            ⎥  ⎢                           ⎥  ⎢                      \n",
       "⎢⎢0  ────────  0   0 ⎥  ⎢   4⋅z                     ⎥  ⎢ 0   0      0         \n",
       "⎢⎢      2            ⎥  ⎢u⋅ℯ                  2  4⋅z⎥  ⎢                      \n",
       "⎢⎢                   ⎥  ⎢──────     0     0  u ⋅ℯ   ⎥  ⎢                      \n",
       "⎢⎢0     0      0   0 ⎥  ⎢  2                        ⎥  ⎢ 0   0      0      -12\n",
       "⎢⎢                   ⎥  ⎢                           ⎥  ⎢                      \n",
       "⎢⎢                -u ⎥  ⎢  0        0     0     0   ⎥  ⎢ -z          -2⋅z     \n",
       "⎢⎢0     0      0  ───⎥  ⎢                           ⎥  ⎣ℯ    0  -12⋅ℯ       -u\n",
       "⎢⎣                 2 ⎦  ⎢         2  4⋅z            ⎥                         \n",
       "⎣                       ⎣  0     u ⋅ℯ     0     0   ⎦                         \n",
       "\n",
       "                                   ⎤\n",
       "         ⎡                       u⎤⎥\n",
       " -z   ⎤  ⎢0     0         0      ─⎥⎥\n",
       "ℯ     ⎥  ⎢                       2⎥⎥\n",
       "      ⎥  ⎢                        ⎥⎥\n",
       " 0    ⎥  ⎢     2  4⋅z             ⎥⎥\n",
       "      ⎥  ⎢0  -u ⋅ℯ        0      0⎥⎥\n",
       "  -2⋅z⎥  ⎢                        ⎥⎥\n",
       "⋅ℯ    ⎥  ⎢                 -2⋅z   ⎥⎥\n",
       "      ⎥  ⎢0     0      12⋅ℯ      0⎥⎥\n",
       "  -z  ⎥  ⎢                        ⎥⎥\n",
       "⋅ℯ    ⎦  ⎢u                       ⎥⎥\n",
       "         ⎢─     0         0      0⎥⎥\n",
       "         ⎣2                       ⎦⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 3 u e^{4 z} & 0 & 0\\\\0 & 0 & \\frac{24 e^{- 2 z}}{u} & 12 e^{- z}\\\\0 & 0 & 12 e^{- z} & 6 u\\end{matrix}\\right] & \\left[\\begin{matrix}0 & \\frac{1}{u} & 0 & 0\\\\\\frac{1}{u} & 0 & 0 & 2\\\\0 & 0 & 0 & 0\\\\0 & 2 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & \\frac{u e^{5 z}}{2} & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & \\frac{u e^{z}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & \\frac{1}{u}\\\\0 & - 3 e^{4 z} & 0 & 0\\\\0 & 0 & \\frac{24 e^{- 2 z}}{u^{2}} & 0\\\\\\frac{1}{u} & 0 & 0 & -1\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                                                                     ⎡       \n",
       "⎢                                                                     ⎢0     0\n",
       "⎢⎡0     0         0        0   ⎤                ⎡0    0     0   0  ⎤  ⎢       \n",
       "⎢⎢                             ⎥  ⎡   1      ⎤  ⎢                  ⎥  ⎢       \n",
       "⎢⎢        4⋅z                  ⎥  ⎢0  ─  0  0⎥  ⎢      5⋅z         ⎥  ⎢       \n",
       "⎢⎢0  3⋅u⋅ℯ        0        0   ⎥  ⎢   u      ⎥  ⎢   u⋅ℯ            ⎥  ⎢0  -3⋅ℯ\n",
       "⎢⎢                             ⎥  ⎢          ⎥  ⎢0  ──────  0   0  ⎥  ⎢       \n",
       "⎢⎢                 -2⋅z        ⎥  ⎢1         ⎥  ⎢     2            ⎥  ⎢       \n",
       "⎢⎢             24⋅ℯ          -z⎥  ⎢─  0  0  2⎥  ⎢                  ⎥  ⎢       \n",
       "⎢⎢0     0      ────────  12⋅ℯ  ⎥  ⎢u         ⎥  ⎢0    0     0   0  ⎥  ⎢0     0\n",
       "⎢⎢                u            ⎥  ⎢          ⎥  ⎢                  ⎥  ⎢       \n",
       "⎢⎢                             ⎥  ⎢0  0  0  0⎥  ⎢                 z⎥  ⎢       \n",
       "⎢⎢                  -z         ⎥  ⎢          ⎥  ⎢              u⋅ℯ ⎥  ⎢       \n",
       "⎢⎣0     0       12⋅ℯ      6⋅u  ⎦  ⎣0  2  0  0⎦  ⎢0    0     0  ────⎥  ⎢1      \n",
       "⎢                                               ⎣               2  ⎦  ⎢─     0\n",
       "⎣                                                                     ⎣u      \n",
       "\n",
       "               1 ⎤⎤\n",
       "        0      ─ ⎥⎥\n",
       "               u ⎥⎥\n",
       "                 ⎥⎥\n",
       "4⋅z              ⎥⎥\n",
       "        0      0 ⎥⎥\n",
       "                 ⎥⎥\n",
       "         -2⋅z    ⎥⎥\n",
       "     24⋅ℯ        ⎥⎥\n",
       "     ────────  0 ⎥⎥\n",
       "         2       ⎥⎥\n",
       "        u        ⎥⎥\n",
       "                 ⎥⎥\n",
       "                 ⎥⎥\n",
       "        0      -1⎥⎥\n",
       "                 ⎦⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_christoffel_symbols(g4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Schwarzschild Metric\n",
    "\n",
    "The classic black hole solution. Uncharged and rotationally stationary."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "schwarzschild = build_ga_from_solution(Solution().schwarzschild())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_t}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_r}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\theta }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\phi }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(schwarzschild.mv())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' \\\\left [ \\\\begin{array}{cccc} - \\\\frac{2 G M}{c^{2} r} + 1 & 0 & 0 & 0  \\\\\\\\ 0 & - \\\\frac{1}{- \\\\frac{2 G M}{c^{2} r} + 1} & 0 & 0  \\\\\\\\ 0 & 0 & - r^{2} & 0  \\\\\\\\ 0 & 0 & 0 & - r^{2} {\\\\sin{\\\\left (\\\\theta  \\\\right )}}^{2}  \\\\end{array}\\\\right ] '"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}- \\frac{2 G M}{c^{2} r} + 1 & 0 & 0 & 0\\\\0 & - \\frac{1}{- \\frac{2 G M}{c^{2} r} + 1} & 0 & 0\\\\0 & 0 & - r^{2} & 0\\\\0 & 0 & 0 & - r^{2} \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "None"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "schwarzschild.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$- r^{4} \\sin^{2}{\\left (\\theta \\right )}$$"
      ],
      "text/plain": [
       "  4    2   \n",
       "-r ⋅sin (θ)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "schwarzschild.e_sq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left [ 1, \\quad - \\frac{\\frac{2 G M}{c^{2} r} - 1}{- \\frac{2 G M}{c^{2} r} + 1}, \\quad 1, \\quad 1\\right ]$$"
      ],
      "text/plain": [
       "⎡    ⎛2⋅G⋅M    ⎞       ⎤\n",
       "⎢   -⎜───── - 1⎟       ⎥\n",
       "⎢    ⎜  2      ⎟       ⎥\n",
       "⎢    ⎝ c ⋅r    ⎠       ⎥\n",
       "⎢1, ─────────────, 1, 1⎥\n",
       "⎢      2⋅G⋅M           ⎥\n",
       "⎢    - ───── + 1       ⎥\n",
       "⎢        2             ⎥\n",
       "⎣       c ⋅r           ⎦"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(schwarzschild)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(schwarzschild)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{G M}{c^{2} r^{2}} & 0 & 0\\\\\\frac{G M}{c^{2} r^{2}} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}- \\frac{G M}{c^{2} r^{2}} & 0 & 0 & 0\\\\0 & \\frac{G M c^{2}}{4 G^{2} M^{2} + c^{2} r \\left(- 4 G M + c^{2} r\\right)} & 0 & 0\\\\0 & 0 & r & 0\\\\0 & 0 & 0 & r \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & - r & 0\\\\0 & - r & 0 & 0\\\\0 & 0 & 0 & \\frac{r^{2} \\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & - r \\sin^{2}{\\left (\\theta \\right )}\\\\0 & 0 & 0 & - \\frac{r^{2} \\sin{\\left (2 \\theta \\right )}}{2}\\\\0 & - r \\sin^{2}{\\left (\\theta \\right )} & - \\frac{r^{2} \\sin{\\left (2 \\theta \\right )}}{2} & 0\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                      ⎡-G⋅M                                               ⎤  \n",
       "⎢⎡        G⋅M       ⎤  ⎢─────                0                 0      0    ⎥  \n",
       "⎢⎢  0    ─────  0  0⎥  ⎢ 2  2                                              ⎥  \n",
       "⎢⎢        2  2      ⎥  ⎢c ⋅r                                               ⎥  \n",
       "⎢⎢       c ⋅r       ⎥  ⎢                                                   ⎥  \n",
       "⎢⎢                  ⎥  ⎢                        2                          ⎥  \n",
       "⎢⎢ G⋅M              ⎥  ⎢                   G⋅M⋅c                           ⎥  \n",
       "⎢⎢─────    0    0  0⎥  ⎢  0    ──────────────────────────────  0      0    ⎥  \n",
       "⎢⎢ 2  2             ⎥  ⎢          2  2    2   ⎛          2  ⎞              ⎥  \n",
       "⎢⎢c ⋅r              ⎥  ⎢       4⋅G ⋅M  + c ⋅r⋅⎝-4⋅G⋅M + c ⋅r⎠              ⎥  \n",
       "⎢⎢                  ⎥  ⎢                                                   ⎥  \n",
       "⎢⎢  0      0    0  0⎥  ⎢  0                  0                 r      0    ⎥  \n",
       "⎢⎢                  ⎥  ⎢                                                   ⎥  \n",
       "⎢⎣  0      0    0  0⎦  ⎢                                               2   ⎥  \n",
       "⎣                      ⎣  0                  0                 0  r⋅sin (θ)⎦  \n",
       "\n",
       "                          ⎡0      0             0              0      ⎤⎤\n",
       "                          ⎢                                           ⎥⎥\n",
       "⎡0  0   0        0     ⎤  ⎢                                     2     ⎥⎥\n",
       "⎢                      ⎥  ⎢0      0             0         -r⋅sin (θ)  ⎥⎥\n",
       "⎢0  0   -r       0     ⎥  ⎢                                           ⎥⎥\n",
       "⎢                      ⎥  ⎢                                2          ⎥⎥\n",
       "⎢0  -r  0        0     ⎥  ⎢                              -r ⋅sin(2⋅θ) ⎥⎥\n",
       "⎢                      ⎥  ⎢0      0             0        ─────────────⎥⎥\n",
       "⎢            2         ⎥  ⎢                                    2      ⎥⎥\n",
       "⎢           r ⋅sin(2⋅θ)⎥  ⎢                                           ⎥⎥\n",
       "⎢0  0   0   ───────────⎥  ⎢                 2                         ⎥⎥\n",
       "⎣                2     ⎦  ⎢         2     -r ⋅sin(2⋅θ)                ⎥⎥\n",
       "                          ⎢0  -r⋅sin (θ)  ─────────────        0      ⎥⎥\n",
       "                          ⎣                     2                     ⎦⎥\n",
       "                                                                       ⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{G M}{r \\left(- 2 G M + c^{2} r\\right)} & 0 & 0\\\\\\frac{G M}{r \\left(- 2 G M + c^{2} r\\right)} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}\\frac{G M \\left(- 2 G M + c^{2} r\\right)}{c^{4} r^{3}} & 0 & 0 & 0\\\\0 & \\frac{G M}{r \\left(2 G M - c^{2} r\\right)} & 0 & 0\\\\0 & 0 & \\frac{2 G M}{c^{2}} - r & 0\\\\0 & 0 & 0 & \\frac{\\left(2 G M - c^{2} r\\right) \\sin^{2}{\\left (\\theta \\right )}}{c^{2}}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & \\frac{1}{r} & 0\\\\0 & \\frac{1}{r} & 0 & 0\\\\0 & 0 & 0 & - \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & \\frac{1}{r}\\\\0 & 0 & 0 & \\frac{1}{\\tan{\\left (\\theta \\right )}}\\\\0 & \\frac{1}{r} & \\frac{1}{\\tan{\\left (\\theta \\right )}} & 0\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                                              ⎡    ⎛          2  ⎞           \n",
       "⎢                                              ⎢G⋅M⋅⎝-2⋅G⋅M + c ⋅r⎠           \n",
       "⎢                                              ⎢───────────────────         0 \n",
       "⎢                                              ⎢        4  3                  \n",
       "⎢⎡                          G⋅M             ⎤  ⎢       c ⋅r                   \n",
       "⎢⎢        0          ─────────────────  0  0⎥  ⎢                              \n",
       "⎢⎢                     ⎛          2  ⎞      ⎥  ⎢                           G⋅M\n",
       "⎢⎢                   r⋅⎝-2⋅G⋅M + c ⋅r⎠      ⎥  ⎢         0           ─────────\n",
       "⎢⎢                                          ⎥  ⎢                       ⎛      \n",
       "⎢⎢       G⋅M                                ⎥  ⎢                     r⋅⎝2⋅G⋅M \n",
       "⎢⎢─────────────────          0          0  0⎥  ⎢                              \n",
       "⎢⎢  ⎛          2  ⎞                         ⎥  ⎢                              \n",
       "⎢⎢r⋅⎝-2⋅G⋅M + c ⋅r⎠                         ⎥  ⎢         0                  0 \n",
       "⎢⎢                                          ⎥  ⎢                              \n",
       "⎢⎢        0                  0          0  0⎥  ⎢                              \n",
       "⎢⎢                                          ⎥  ⎢                              \n",
       "⎢⎣        0                  0          0  0⎦  ⎢                              \n",
       "⎢                                              ⎢                              \n",
       "⎢                                              ⎢         0                  0 \n",
       "⎢                                              ⎢                              \n",
       "⎣                                              ⎣                              \n",
       "\n",
       "                                          ⎤                                   \n",
       "                                          ⎥                                   \n",
       "             0                0           ⎥                                   \n",
       "                                          ⎥                                   \n",
       "                                          ⎥  ⎡0  0  0      0     ⎤  ⎡0  0    0\n",
       "                                          ⎥  ⎢                   ⎥  ⎢         \n",
       "                                          ⎥  ⎢      1            ⎥  ⎢         \n",
       "───────      0                0           ⎥  ⎢0  0  ─      0     ⎥  ⎢0  0    0\n",
       "   2  ⎞                                   ⎥  ⎢      r            ⎥  ⎢         \n",
       "- c ⋅r⎠                                   ⎥  ⎢                   ⎥  ⎢         \n",
       "                                          ⎥  ⎢   1               ⎥  ⎢         \n",
       "         2⋅G⋅M                            ⎥  ⎢0  ─  0      0     ⎥  ⎢0  0    0\n",
       "         ───── - r            0           ⎥  ⎢   r               ⎥  ⎢         \n",
       "            2                             ⎥  ⎢                   ⎥  ⎢         \n",
       "           c                              ⎥  ⎢         -sin(2⋅θ) ⎥  ⎢   1    1\n",
       "                                          ⎥  ⎢0  0  0  ──────────⎥  ⎢0  ─  ───\n",
       "                    ⎛         2  ⎞    2   ⎥  ⎣             2     ⎦  ⎣   r  tan\n",
       "                    ⎝2⋅G⋅M - c ⋅r⎠⋅sin (θ)⎥                                   \n",
       "             0      ──────────────────────⎥                                   \n",
       "                               2          ⎥                                   \n",
       "                              c           ⎦                                   \n",
       "\n",
       "            ⎤\n",
       "            ⎥\n",
       "            ⎥\n",
       "            ⎥\n",
       "       0   ⎤⎥\n",
       "           ⎥⎥\n",
       "       1   ⎥⎥\n",
       "       ─   ⎥⎥\n",
       "       r   ⎥⎥\n",
       "           ⎥⎥\n",
       "       1   ⎥⎥\n",
       "     ──────⎥⎥\n",
       "     tan(θ)⎥⎥\n",
       "           ⎥⎥\n",
       "           ⎥⎥\n",
       "───    0   ⎥⎥\n",
       "(θ)        ⎦⎥\n",
       "            ⎥\n",
       "            ⎥\n",
       "            ⎥\n",
       "            ⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_christoffel_symbols(schwarzschild)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Einstein-Rosen Bridge Metric\n",
    "\n",
    "The most famous wormhole solution."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "einstein_rosen_bridge = build_ga_from_solution(Solution().einstein_rosen_bridge())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_t}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_r}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\theta }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\phi }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(einstein_rosen_bridge.mv())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' \\\\left [ \\\\begin{array}{cccc} \\\\frac{- 2 m + r}{r} & 0 & 0 & 0  \\\\\\\\ 0 & - \\\\frac{4 r}{- 4 m + 2 r} & 0 & 0  \\\\\\\\ 0 & 0 & - r^{2} & 0  \\\\\\\\ 0 & 0 & 0 & - r^{2} {\\\\sin{\\\\left (\\\\theta  \\\\right )}}^{2}  \\\\end{array}\\\\right ] '"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\frac{- 2 m + r}{r} & 0 & 0 & 0\\\\0 & - \\frac{4 r}{- 4 m + 2 r} & 0 & 0\\\\0 & 0 & - r^{2} & 0\\\\0 & 0 & 0 & - r^{2} \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "None"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "einstein_rosen_bridge.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$- 2 r^{4} \\sin^{2}{\\left (\\theta \\right )}$$"
      ],
      "text/plain": [
       "    4    2   \n",
       "-2⋅r ⋅sin (θ)"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "einstein_rosen_bridge.e_sq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left [ 1, \\quad - \\frac{4 r \\left(\\frac{m}{r} - \\frac{1}{2}\\right)}{- 4 m + 2 r}, \\quad 1, \\quad 1\\right ]$$"
      ],
      "text/plain": [
       "⎡        ⎛m   1⎞       ⎤\n",
       "⎢   -4⋅r⋅⎜─ - ─⎟       ⎥\n",
       "⎢        ⎝r   2⎠       ⎥\n",
       "⎢1, ─────────────, 1, 1⎥\n",
       "⎣     -4⋅m + 2⋅r       ⎦"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(einstein_rosen_bridge)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(einstein_rosen_bridge)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{m}{r^{2}} & 0 & 0\\\\\\frac{m}{r^{2}} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}- \\frac{m}{r^{2}} & 0 & 0 & 0\\\\0 & \\frac{2 m}{4 m^{2} - 4 m r + r^{2}} & 0 & 0\\\\0 & 0 & r & 0\\\\0 & 0 & 0 & r \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & - r & 0\\\\0 & - r & 0 & 0\\\\0 & 0 & 0 & \\frac{r^{2} \\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & - r \\sin^{2}{\\left (\\theta \\right )}\\\\0 & 0 & 0 & - \\frac{r^{2} \\sin{\\left (2 \\theta \\right )}}{2}\\\\0 & - r \\sin^{2}{\\left (\\theta \\right )} & - \\frac{r^{2} \\sin{\\left (2 \\theta \\right )}}{2} & 0\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                ⎡-m                                  ⎤                       \n",
       "⎢⎡    m       ⎤  ⎢───          0          0      0    ⎥                       \n",
       "⎢⎢0   ──  0  0⎥  ⎢  2                                 ⎥  ⎡0  0   0        0   \n",
       "⎢⎢     2      ⎥  ⎢ r                                  ⎥  ⎢                    \n",
       "⎢⎢    r       ⎥  ⎢                                    ⎥  ⎢0  0   -r       0   \n",
       "⎢⎢            ⎥  ⎢            2⋅m                     ⎥  ⎢                    \n",
       "⎢⎢m           ⎥  ⎢ 0   ─────────────────  0      0    ⎥  ⎢0  -r  0        0   \n",
       "⎢⎢──  0   0  0⎥  ⎢        2            2              ⎥  ⎢                    \n",
       "⎢⎢ 2          ⎥  ⎢     4⋅m  - 4⋅m⋅r + r               ⎥  ⎢            2       \n",
       "⎢⎢r           ⎥  ⎢                                    ⎥  ⎢           r ⋅sin(2⋅\n",
       "⎢⎢            ⎥  ⎢ 0           0          r      0    ⎥  ⎢0  0   0   ─────────\n",
       "⎢⎢0   0   0  0⎥  ⎢                                    ⎥  ⎣                2   \n",
       "⎢⎢            ⎥  ⎢                                2   ⎥                       \n",
       "⎣⎣0   0   0  0⎦  ⎣ 0           0          0  r⋅sin (θ)⎦                       \n",
       "\n",
       "     ⎡0      0             0              0      ⎤⎤\n",
       "     ⎢                                           ⎥⎥\n",
       "  ⎤  ⎢                                     2     ⎥⎥\n",
       "  ⎥  ⎢0      0             0         -r⋅sin (θ)  ⎥⎥\n",
       "  ⎥  ⎢                                           ⎥⎥\n",
       "  ⎥  ⎢                                2          ⎥⎥\n",
       "  ⎥  ⎢                              -r ⋅sin(2⋅θ) ⎥⎥\n",
       "  ⎥  ⎢0      0             0        ─────────────⎥⎥\n",
       "  ⎥  ⎢                                    2      ⎥⎥\n",
       "θ)⎥  ⎢                                           ⎥⎥\n",
       "──⎥  ⎢                 2                         ⎥⎥\n",
       "  ⎦  ⎢         2     -r ⋅sin(2⋅θ)                ⎥⎥\n",
       "     ⎢0  -r⋅sin (θ)  ─────────────        0      ⎥⎥\n",
       "     ⎣                     2                     ⎦⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{m}{r \\left(- 2 m + r\\right)} & 0 & 0\\\\\\frac{m}{r \\left(- 2 m + r\\right)} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}\\frac{m \\left(- 2 m + r\\right)}{2 r^{3}} & 0 & 0 & 0\\\\0 & \\frac{m}{r \\left(2 m - r\\right)} & 0 & 0\\\\0 & 0 & m - \\frac{r}{2} & 0\\\\0 & 0 & 0 & \\left(m - \\frac{r}{2}\\right) \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & \\frac{1}{r} & 0\\\\0 & \\frac{1}{r} & 0 & 0\\\\0 & 0 & 0 & - \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & \\frac{1}{r}\\\\0 & 0 & 0 & \\frac{1}{\\tan{\\left (\\theta \\right )}}\\\\0 & \\frac{1}{r} & \\frac{1}{\\tan{\\left (\\theta \\right )}} & 0\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                                    ⎡m⋅(-2⋅m + r)                            \n",
       "⎢                                    ⎢────────────       0         0          \n",
       "⎢                                    ⎢       3                                \n",
       "⎢⎡                   m            ⎤  ⎢    2⋅r                                 \n",
       "⎢⎢     0        ────────────  0  0⎥  ⎢                                        \n",
       "⎢⎢              r⋅(-2⋅m + r)      ⎥  ⎢                   m                    \n",
       "⎢⎢                                ⎥  ⎢     0        ───────────    0          \n",
       "⎢⎢     m                          ⎥  ⎢              r⋅(2⋅m - r)               \n",
       "⎢⎢────────────       0        0  0⎥  ⎢                                        \n",
       "⎢⎢r⋅(-2⋅m + r)                    ⎥  ⎢                               r        \n",
       "⎢⎢                                ⎥  ⎢     0             0       m - ─        \n",
       "⎢⎢     0             0        0  0⎥  ⎢                               2        \n",
       "⎢⎢                                ⎥  ⎢                                        \n",
       "⎢⎣     0             0        0  0⎦  ⎢                                  ⎛    r\n",
       "⎢                                    ⎢     0             0         0    ⎜m - ─\n",
       "⎣                                    ⎣                                  ⎝    2\n",
       "\n",
       "         ⎤                                               ⎤\n",
       " 0       ⎥                                               ⎥\n",
       "         ⎥  ⎡0  0  0      0     ⎤  ⎡0  0    0       0   ⎤⎥\n",
       "         ⎥  ⎢                   ⎥  ⎢                    ⎥⎥\n",
       "         ⎥  ⎢      1            ⎥  ⎢                1   ⎥⎥\n",
       "         ⎥  ⎢0  0  ─      0     ⎥  ⎢0  0    0       ─   ⎥⎥\n",
       " 0       ⎥  ⎢      r            ⎥  ⎢                r   ⎥⎥\n",
       "         ⎥  ⎢                   ⎥  ⎢                    ⎥⎥\n",
       "         ⎥  ⎢   1               ⎥  ⎢                1   ⎥⎥\n",
       "         ⎥  ⎢0  ─  0      0     ⎥  ⎢0  0    0     ──────⎥⎥\n",
       " 0       ⎥  ⎢   r               ⎥  ⎢              tan(θ)⎥⎥\n",
       "         ⎥  ⎢                   ⎥  ⎢                    ⎥⎥\n",
       "         ⎥  ⎢         -sin(2⋅θ) ⎥  ⎢   1    1           ⎥⎥\n",
       "⎞    2   ⎥  ⎢0  0  0  ──────────⎥  ⎢0  ─  ──────    0   ⎥⎥\n",
       "⎟⋅sin (θ)⎥  ⎣             2     ⎦  ⎣   r  tan(θ)        ⎦⎥\n",
       "⎠        ⎦                                               ⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_christoffel_symbols(einstein_rosen_bridge)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Weak Field Approximation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "wfa = build_ga_from_solution(Solution().weak_field_approximation())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_t}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_r}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\theta }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\phi }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(wfa.mv())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' \\\\left [ \\\\begin{array}{cccc} c^{2} \\\\left(- \\\\frac{2 G M}{c^{2} r} + 1\\\\right) & 0 & 0 & 0  \\\\\\\\ 0 & - \\\\frac{1}{- \\\\frac{2 G M}{c^{2} r} + 1} & 0 & 0  \\\\\\\\ 0 & 0 & - r^{2} & 0  \\\\\\\\ 0 & 0 & 0 & - r^{2} {\\\\sin{\\\\left (\\\\theta  \\\\right )}}^{2}  \\\\end{array}\\\\right ] '"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}c^{2} \\left(- \\frac{2 G M}{c^{2} r} + 1\\right) & 0 & 0 & 0\\\\0 & - \\frac{1}{- \\frac{2 G M}{c^{2} r} + 1} & 0 & 0\\\\0 & 0 & - r^{2} & 0\\\\0 & 0 & 0 & - r^{2} \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "None"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wfa.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left ( \\frac{r}{- 2 G M + c^{2} r} \\boldsymbol{_t}, \\quad \\left ( \\frac{2 G M}{c^{2} r} - 1\\right ) \\boldsymbol{_r}, \\quad - \\frac{1}{r^{2}} \\boldsymbol{_\\theta }, \\quad - \\frac{1}{r^{2} {\\sin{\\left (\\theta  \\right )}}^{2}} \\boldsymbol{_\\phi }\\right )$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(wfa.mvr())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$- c^{2} r^{4} \\sin^{2}{\\left (\\theta \\right )}$$"
      ],
      "text/plain": [
       "  2  4    2   \n",
       "-c ⋅r ⋅sin (θ)"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wfa.e_sq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left [ \\frac{c^{2} \\left(- \\frac{2 G M}{c^{2} r} + 1\\right)}{- \\frac{2 G M}{r} + c^{2}}, \\quad - \\frac{\\frac{2 G M}{c^{2} r} - 1}{- \\frac{2 G M}{c^{2} r} + 1}, \\quad 1, \\quad 1\\right ]$$"
      ],
      "text/plain": [
       "⎡ 2 ⎛  2⋅G⋅M    ⎞   ⎛2⋅G⋅M    ⎞       ⎤\n",
       "⎢c ⋅⎜- ───── + 1⎟  -⎜───── - 1⎟       ⎥\n",
       "⎢   ⎜    2      ⎟   ⎜  2      ⎟       ⎥\n",
       "⎢   ⎝   c ⋅r    ⎠   ⎝ c ⋅r    ⎠       ⎥\n",
       "⎢────────────────, ─────────────, 1, 1⎥\n",
       "⎢    2⋅G⋅M    2       2⋅G⋅M           ⎥\n",
       "⎢  - ───── + c      - ───── + 1       ⎥\n",
       "⎢      r                2             ⎥\n",
       "⎣                      c ⋅r           ⎦"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(wfa)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(wfa)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wfa.connect_flg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{G M}{r^{2}} & 0 & 0\\\\\\frac{G M}{r^{2}} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}- \\frac{G M}{r^{2}} & 0 & 0 & 0\\\\0 & \\frac{G M c^{2}}{4 G^{2} M^{2} + c^{2} r \\left(- 4 G M + c^{2} r\\right)} & 0 & 0\\\\0 & 0 & r & 0\\\\0 & 0 & 0 & r \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & - r & 0\\\\0 & - r & 0 & 0\\\\0 & 0 & 0 & \\frac{r^{2} \\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & - r \\sin^{2}{\\left (\\theta \\right )}\\\\0 & 0 & 0 & - \\frac{r^{2} \\sin{\\left (2 \\theta \\right )}}{2}\\\\0 & - r \\sin^{2}{\\left (\\theta \\right )} & - \\frac{r^{2} \\sin{\\left (2 \\theta \\right )}}{2} & 0\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                  ⎡-G⋅M                                               ⎤      \n",
       "⎢⎡     G⋅M      ⎤  ⎢─────                0                 0      0    ⎥      \n",
       "⎢⎢ 0   ───  0  0⎥  ⎢   2                                               ⎥  ⎡0  \n",
       "⎢⎢       2      ⎥  ⎢  r                                                ⎥  ⎢   \n",
       "⎢⎢      r       ⎥  ⎢                                                   ⎥  ⎢0  \n",
       "⎢⎢              ⎥  ⎢                        2                          ⎥  ⎢   \n",
       "⎢⎢G⋅M           ⎥  ⎢                   G⋅M⋅c                           ⎥  ⎢0  \n",
       "⎢⎢───   0   0  0⎥  ⎢  0    ──────────────────────────────  0      0    ⎥  ⎢   \n",
       "⎢⎢  2           ⎥  ⎢          2  2    2   ⎛          2  ⎞              ⎥  ⎢   \n",
       "⎢⎢ r            ⎥  ⎢       4⋅G ⋅M  + c ⋅r⋅⎝-4⋅G⋅M + c ⋅r⎠              ⎥  ⎢   \n",
       "⎢⎢              ⎥  ⎢                                                   ⎥  ⎢0  \n",
       "⎢⎢ 0    0   0  0⎥  ⎢  0                  0                 r      0    ⎥  ⎣   \n",
       "⎢⎢              ⎥  ⎢                                                   ⎥      \n",
       "⎢⎣ 0    0   0  0⎦  ⎢                                               2   ⎥      \n",
       "⎣                  ⎣  0                  0                 0  r⋅sin (θ)⎦      \n",
       "\n",
       "                      ⎡0      0             0              0      ⎤⎤\n",
       "                      ⎢                                           ⎥⎥\n",
       "0   0        0     ⎤  ⎢                                     2     ⎥⎥\n",
       "                   ⎥  ⎢0      0             0         -r⋅sin (θ)  ⎥⎥\n",
       "0   -r       0     ⎥  ⎢                                           ⎥⎥\n",
       "                   ⎥  ⎢                                2          ⎥⎥\n",
       "-r  0        0     ⎥  ⎢                              -r ⋅sin(2⋅θ) ⎥⎥\n",
       "                   ⎥  ⎢0      0             0        ─────────────⎥⎥\n",
       "         2         ⎥  ⎢                                    2      ⎥⎥\n",
       "        r ⋅sin(2⋅θ)⎥  ⎢                                           ⎥⎥\n",
       "0   0   ───────────⎥  ⎢                 2                         ⎥⎥\n",
       "             2     ⎦  ⎢         2     -r ⋅sin(2⋅θ)                ⎥⎥\n",
       "                      ⎢0  -r⋅sin (θ)  ─────────────        0      ⎥⎥\n",
       "                      ⎣                     2                     ⎦⎥\n",
       "                                                                   ⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{G M}{r \\left(- 2 G M + c^{2} r\\right)} & 0 & 0\\\\\\frac{G M}{r \\left(- 2 G M + c^{2} r\\right)} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}\\frac{G M \\left(- 2 G M + c^{2} r\\right)}{c^{2} r^{3}} & 0 & 0 & 0\\\\0 & \\frac{G M}{r \\left(2 G M - c^{2} r\\right)} & 0 & 0\\\\0 & 0 & \\frac{2 G M}{c^{2}} - r & 0\\\\0 & 0 & 0 & \\frac{\\left(2 G M - c^{2} r\\right) \\sin^{2}{\\left (\\theta \\right )}}{c^{2}}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & \\frac{1}{r} & 0\\\\0 & \\frac{1}{r} & 0 & 0\\\\0 & 0 & 0 & - \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & \\frac{1}{r}\\\\0 & 0 & 0 & \\frac{1}{\\tan{\\left (\\theta \\right )}}\\\\0 & \\frac{1}{r} & \\frac{1}{\\tan{\\left (\\theta \\right )}} & 0\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                                              ⎡    ⎛          2  ⎞           \n",
       "⎢                                              ⎢G⋅M⋅⎝-2⋅G⋅M + c ⋅r⎠           \n",
       "⎢                                              ⎢───────────────────         0 \n",
       "⎢                                              ⎢        2  3                  \n",
       "⎢⎡                          G⋅M             ⎤  ⎢       c ⋅r                   \n",
       "⎢⎢        0          ─────────────────  0  0⎥  ⎢                              \n",
       "⎢⎢                     ⎛          2  ⎞      ⎥  ⎢                           G⋅M\n",
       "⎢⎢                   r⋅⎝-2⋅G⋅M + c ⋅r⎠      ⎥  ⎢         0           ─────────\n",
       "⎢⎢                                          ⎥  ⎢                       ⎛      \n",
       "⎢⎢       G⋅M                                ⎥  ⎢                     r⋅⎝2⋅G⋅M \n",
       "⎢⎢─────────────────          0          0  0⎥  ⎢                              \n",
       "⎢⎢  ⎛          2  ⎞                         ⎥  ⎢                              \n",
       "⎢⎢r⋅⎝-2⋅G⋅M + c ⋅r⎠                         ⎥  ⎢         0                  0 \n",
       "⎢⎢                                          ⎥  ⎢                              \n",
       "⎢⎢        0                  0          0  0⎥  ⎢                              \n",
       "⎢⎢                                          ⎥  ⎢                              \n",
       "⎢⎣        0                  0          0  0⎦  ⎢                              \n",
       "⎢                                              ⎢                              \n",
       "⎢                                              ⎢         0                  0 \n",
       "⎢                                              ⎢                              \n",
       "⎣                                              ⎣                              \n",
       "\n",
       "                                          ⎤                                   \n",
       "                                          ⎥                                   \n",
       "             0                0           ⎥                                   \n",
       "                                          ⎥                                   \n",
       "                                          ⎥  ⎡0  0  0      0     ⎤  ⎡0  0    0\n",
       "                                          ⎥  ⎢                   ⎥  ⎢         \n",
       "                                          ⎥  ⎢      1            ⎥  ⎢         \n",
       "───────      0                0           ⎥  ⎢0  0  ─      0     ⎥  ⎢0  0    0\n",
       "   2  ⎞                                   ⎥  ⎢      r            ⎥  ⎢         \n",
       "- c ⋅r⎠                                   ⎥  ⎢                   ⎥  ⎢         \n",
       "                                          ⎥  ⎢   1               ⎥  ⎢         \n",
       "         2⋅G⋅M                            ⎥  ⎢0  ─  0      0     ⎥  ⎢0  0    0\n",
       "         ───── - r            0           ⎥  ⎢   r               ⎥  ⎢         \n",
       "            2                             ⎥  ⎢                   ⎥  ⎢         \n",
       "           c                              ⎥  ⎢         -sin(2⋅θ) ⎥  ⎢   1    1\n",
       "                                          ⎥  ⎢0  0  0  ──────────⎥  ⎢0  ─  ───\n",
       "                    ⎛         2  ⎞    2   ⎥  ⎣             2     ⎦  ⎣   r  tan\n",
       "                    ⎝2⋅G⋅M - c ⋅r⎠⋅sin (θ)⎥                                   \n",
       "             0      ──────────────────────⎥                                   \n",
       "                               2          ⎥                                   \n",
       "                              c           ⎦                                   \n",
       "\n",
       "            ⎤\n",
       "            ⎥\n",
       "            ⎥\n",
       "            ⎥\n",
       "       0   ⎤⎥\n",
       "           ⎥⎥\n",
       "       1   ⎥⎥\n",
       "       ─   ⎥⎥\n",
       "       r   ⎥⎥\n",
       "           ⎥⎥\n",
       "       1   ⎥⎥\n",
       "     ──────⎥⎥\n",
       "     tan(θ)⎥⎥\n",
       "           ⎥⎥\n",
       "           ⎥⎥\n",
       "───    0   ⎥⎥\n",
       "(θ)        ⎦⎥\n",
       "            ⎥\n",
       "            ⎥\n",
       "            ⎥\n",
       "            ⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_christoffel_symbols(wfa)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Friedmann Lemaitre Robertson Walker metric\n",
    "\n",
    "The spacetime for an expanding universe."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "flrw = build_ga_from_solution(Solution().friedmann_lemaitre_robertson_walker())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_t}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_r}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\theta }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\phi }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(flrw.mv())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' \\\\left [ \\\\begin{array}{cccc} 1 & 0 & 0 & 0  \\\\\\\\ 0 & - \\\\frac{{a }^{2}}{- k r^{2} + 1} & 0 & 0  \\\\\\\\ 0 & 0 & - r^{2} {a }^{2} & 0  \\\\\\\\ 0 & 0 & 0 & - r^{2} {a }^{2} {\\\\sin{\\\\left (\\\\theta  \\\\right )}}^{2}  \\\\end{array}\\\\right ] '"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & - \\frac{a^{2}{\\left (t \\right )}}{- k r^{2} + 1} & 0 & 0\\\\0 & 0 & - r^{2} a^{2}{\\left (t \\right )} & 0\\\\0 & 0 & 0 & - r^{2} a^{2}{\\left (t \\right )} \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "None"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "flrw.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\frac{r^{4} a^{6}{\\left (t \\right )} \\sin^{2}{\\left (\\theta \\right )}}{k r^{2} - 1}$$"
      ],
      "text/plain": [
       " 4  6       2   \n",
       "r ⋅a (t)⋅sin (θ)\n",
       "────────────────\n",
       "       2        \n",
       "    k⋅r  - 1    "
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "flrw.e_sq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left [ 1, \\quad - \\frac{\\left(\\frac{k r^{2}}{a^{2}{\\left (t \\right )}} - \\frac{1}{a^{2}{\\left (t \\right )}}\\right) a^{2}{\\left (t \\right )}}{- k r^{2} + 1}, \\quad 1, \\quad 1\\right ]$$"
      ],
      "text/plain": [
       "⎡    ⎛    2        ⎞             ⎤\n",
       "⎢    ⎜ k⋅r      1  ⎟  2          ⎥\n",
       "⎢   -⎜───── - ─────⎟⋅a (t)       ⎥\n",
       "⎢    ⎜ 2       2   ⎟             ⎥\n",
       "⎢    ⎝a (t)   a (t)⎠             ⎥\n",
       "⎢1, ───────────────────────, 1, 1⎥\n",
       "⎢               2                ⎥\n",
       "⎣          - k⋅r  + 1            ⎦"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(flrw)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(flrw)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Hypersphere Metric\n",
    "\n",
    "A metric which describes a spacetime where the cosmic time is assigned to the meaning of a 4D hypersphere radius. The essential idea behind this spacetime is that the \"3+1\" dimensionality commonly referenced in physics can be meaningfully mapped to the \"3+1\" dimensionality associated with a hypersphere; by the \"3\" angular coordinates and the \"1\" radial coordinate."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "hypersphere = build_ga_from_solution(Solution().hypersphere())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_t}$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\psi }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\theta }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle  \\boldsymbol{_\\phi }$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(hypersphere.mv())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' \\\\left [ \\\\begin{array}{cccc} 1 & 0 & 0 & 0  \\\\\\\\ 0 & - t^{2} & 0 & 0  \\\\\\\\ 0 & 0 & - t^{2} {\\\\sin{\\\\left (\\\\psi  \\\\right )}}^{2} & 0  \\\\\\\\ 0 & 0 & 0 & - t^{2} {\\\\sin{\\\\left (\\\\psi  \\\\right )}}^{2} {\\\\sin{\\\\left (\\\\theta  \\\\right )}}^{2}  \\\\end{array}\\\\right ] '"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & - t^{2} & 0 & 0\\\\0 & 0 & - t^{2} \\sin^{2}{\\left (\\psi \\right )} & 0\\\\0 & 0 & 0 & - t^{2} \\sin^{2}{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "None"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hypersphere.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$- t^{6} \\sin^{4}{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )}$$"
      ],
      "text/plain": [
       "  6    4       2   \n",
       "-t ⋅sin (ψ)⋅sin (θ)"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hypersphere.e_sq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left [ 1, \\quad 1, \\quad 1, \\quad 1\\right ]$$"
      ],
      "text/plain": [
       "[1, 1, 1, 1]"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(hypersphere)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(hypersphere)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & t & 0 & 0\\\\0 & 0 & t \\sin^{2}{\\left (\\psi \\right )} & 0\\\\0 & 0 & 0 & t \\sin^{2}{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & - t & 0 & 0\\\\- t & 0 & 0 & 0\\\\0 & 0 & \\frac{t^{2} \\sin{\\left (2 \\psi \\right )}}{2} & 0\\\\0 & 0 & 0 & t^{2} \\sin{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )} \\cos{\\left (\\psi \\right )}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & - t \\sin^{2}{\\left (\\psi \\right )} & 0\\\\0 & 0 & - \\frac{t^{2} \\sin{\\left (2 \\psi \\right )}}{2} & 0\\\\- t \\sin^{2}{\\left (\\psi \\right )} & - \\frac{t^{2} \\sin{\\left (2 \\psi \\right )}}{2} & 0 & 0\\\\0 & 0 & 0 & t^{2} \\sin^{2}{\\left (\\psi \\right )} \\sin{\\left (\\theta \\right )} \\cos{\\left (\\theta \\right )}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & - t \\sin^{2}{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )}\\\\0 & 0 & 0 & - t^{2} \\sin{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )} \\cos{\\left (\\psi \\right )}\\\\0 & 0 & 0 & - t^{2} \\sin^{2}{\\left (\\psi \\right )} \\sin{\\left (\\theta \\right )} \\cos{\\left (\\theta \\right )}\\\\- t \\sin^{2}{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )} & - t^{2} \\sin{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )} \\cos{\\left (\\psi \\right )} & - t^{2} \\sin^{2}{\\left (\\psi \\right )} \\sin{\\left (\\theta \\right )} \\cos{\\left (\\theta \\right )} & 0\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                                                                             \n",
       "⎢                                                                             \n",
       "⎢                                      ⎡0   -t       0                  0     \n",
       "⎢⎡0  0      0              0        ⎤  ⎢                                      \n",
       "⎢⎢                                  ⎥  ⎢-t  0        0                  0     \n",
       "⎢⎢0  t      0              0        ⎥  ⎢                                      \n",
       "⎢⎢                                  ⎥  ⎢         2                            \n",
       "⎢⎢           2                      ⎥  ⎢        t ⋅sin(2⋅ψ)                   \n",
       "⎢⎢0  0  t⋅sin (ψ)          0        ⎥  ⎢0   0   ───────────             0     \n",
       "⎢⎢                                  ⎥  ⎢             2                        \n",
       "⎢⎢                      2       2   ⎥  ⎢                                      \n",
       "⎢⎣0  0      0      t⋅sin (ψ)⋅sin (θ)⎦  ⎢                      2           2   \n",
       "⎢                                      ⎣0   0        0       t ⋅sin(ψ)⋅sin (θ)\n",
       "⎢                                                                             \n",
       "⎣                                                                             \n",
       "\n",
       "          ⎡                                  2                               ⎤\n",
       "          ⎢    0             0         -t⋅sin (ψ)               0            ⎥\n",
       "       ⎤  ⎢                                                                  ⎥\n",
       "       ⎥  ⎢                             2                                    ⎥\n",
       "       ⎥  ⎢                           -t ⋅sin(2⋅ψ)                           ⎥\n",
       "       ⎥  ⎢    0             0        ─────────────             0            ⎥\n",
       "       ⎥  ⎢                                 2                                ⎥\n",
       "       ⎥  ⎢                                                                  ⎥\n",
       "       ⎥  ⎢              2                                                   ⎥\n",
       "       ⎥  ⎢      2     -t ⋅sin(2⋅ψ)                                          ⎥\n",
       "       ⎥  ⎢-t⋅sin (ψ)  ─────────────        0                   0            ⎥\n",
       "       ⎥  ⎢                  2                                               ⎥\n",
       "⋅cos(ψ)⎦  ⎢                                                                  ⎥\n",
       "          ⎢                                           2    2                 ⎥\n",
       "          ⎣    0             0              0        t ⋅sin (ψ)⋅sin(θ)⋅cos(θ)⎦\n",
       "\n",
       "                                                                              \n",
       "                                                                              \n",
       "  ⎡                                                                           \n",
       "  ⎢        0                       0                          0               \n",
       "  ⎢                                                                           \n",
       "  ⎢                                                                           \n",
       "  ⎢        0                       0                          0              -\n",
       "  ⎢                                                                           \n",
       "  ⎢                                                                           \n",
       "  ⎢        0                       0                          0              -\n",
       "  ⎢                                                                           \n",
       "  ⎢      2       2       2           2              2    2                    \n",
       "  ⎣-t⋅sin (ψ)⋅sin (θ)  -t ⋅sin(ψ)⋅sin (θ)⋅cos(ψ)  -t ⋅sin (ψ)⋅sin(θ)⋅cos(θ)   \n",
       "                                                                              \n",
       "                                                                              \n",
       "\n",
       "                         ⎤\n",
       "                         ⎥\n",
       "        2       2       ⎤⎥\n",
       "  -t⋅sin (ψ)⋅sin (θ)    ⎥⎥\n",
       "                        ⎥⎥\n",
       " 2           2          ⎥⎥\n",
       "t ⋅sin(ψ)⋅sin (θ)⋅cos(ψ)⎥⎥\n",
       "                        ⎥⎥\n",
       " 2    2                 ⎥⎥\n",
       "t ⋅sin (ψ)⋅sin(θ)⋅cos(θ)⎥⎥\n",
       "                        ⎥⎥\n",
       "                        ⎥⎥\n",
       "           0            ⎦⎥\n",
       "                         ⎥\n",
       "                         ⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$$\\left[\\begin{matrix}\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & t & 0 & 0\\\\0 & 0 & t \\sin^{2}{\\left (\\psi \\right )} & 0\\\\0 & 0 & 0 & t \\sin^{2}{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & \\frac{1}{t} & 0 & 0\\\\\\frac{1}{t} & 0 & 0 & 0\\\\0 & 0 & - \\frac{\\sin{\\left (2 \\psi \\right )}}{2} & 0\\\\0 & 0 & 0 & - \\sin{\\left (\\psi \\right )} \\sin^{2}{\\left (\\theta \\right )} \\cos{\\left (\\psi \\right )}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & \\frac{1}{t} & 0\\\\0 & 0 & \\frac{1}{\\tan{\\left (\\psi \\right )}} & 0\\\\\\frac{1}{t} & \\frac{1}{\\tan{\\left (\\psi \\right )}} & 0 & 0\\\\0 & 0 & 0 & - \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & \\frac{1}{t}\\\\0 & 0 & 0 & \\frac{1}{\\tan{\\left (\\psi \\right )}}\\\\0 & 0 & 0 & \\frac{1}{\\tan{\\left (\\theta \\right )}}\\\\\\frac{1}{t} & \\frac{1}{\\tan{\\left (\\psi \\right )}} & \\frac{1}{\\tan{\\left (\\theta \\right )}} & 0\\end{matrix}\\right]\\end{matrix}\\right]$$"
      ],
      "text/plain": [
       "⎡                                      ⎡   1                                  \n",
       "⎢                                      ⎢0  ─      0                 0         \n",
       "⎢                                      ⎢   t                                  \n",
       "⎢⎡0  0      0              0        ⎤  ⎢                                      \n",
       "⎢⎢                                  ⎥  ⎢1                                     \n",
       "⎢⎢0  t      0              0        ⎥  ⎢─  0      0                 0         \n",
       "⎢⎢                                  ⎥  ⎢t                                     \n",
       "⎢⎢           2                      ⎥  ⎢                                      \n",
       "⎢⎢0  0  t⋅sin (ψ)          0        ⎥  ⎢      -sin(2⋅ψ)                       \n",
       "⎢⎢                                  ⎥  ⎢0  0  ──────────            0         \n",
       "⎢⎢                      2       2   ⎥  ⎢          2                           \n",
       "⎢⎣0  0      0      t⋅sin (ψ)⋅sin (θ)⎦  ⎢                                      \n",
       "⎢                                      ⎢                             2        \n",
       "⎢                                      ⎣0  0      0       -sin(ψ)⋅sin (θ)⋅cos(\n",
       "⎣                                                                             \n",
       "\n",
       "  ⎤  ⎡             1               ⎤  ⎡                     1   ⎤⎤\n",
       "  ⎥  ⎢0    0       ─         0     ⎥  ⎢0    0       0       ─   ⎥⎥\n",
       "  ⎥  ⎢             t               ⎥  ⎢                     t   ⎥⎥\n",
       "  ⎥  ⎢                             ⎥  ⎢                         ⎥⎥\n",
       "  ⎥  ⎢             1               ⎥  ⎢                     1   ⎥⎥\n",
       "  ⎥  ⎢0    0     ──────      0     ⎥  ⎢0    0       0     ──────⎥⎥\n",
       "  ⎥  ⎢           tan(ψ)            ⎥  ⎢                   tan(ψ)⎥⎥\n",
       "  ⎥  ⎢                             ⎥  ⎢                         ⎥⎥\n",
       "  ⎥  ⎢1    1                       ⎥  ⎢                     1   ⎥⎥\n",
       "  ⎥  ⎢─  ──────    0         0     ⎥  ⎢0    0       0     ──────⎥⎥\n",
       "  ⎥  ⎢t  tan(ψ)                    ⎥  ⎢                   tan(θ)⎥⎥\n",
       "  ⎥  ⎢                             ⎥  ⎢                         ⎥⎥\n",
       "  ⎥  ⎢                   -sin(2⋅θ) ⎥  ⎢1    1       1           ⎥⎥\n",
       "ψ)⎦  ⎢0    0       0     ──────────⎥  ⎢─  ──────  ──────    0   ⎥⎥\n",
       "     ⎣                       2     ⎦  ⎣t  tan(ψ)  tan(θ)        ⎦⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_christoffel_symbols(hypersphere)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Kerr Metric"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Modified from https://github.com/spacetimeengineer/spacetimeengine/blob/master/spacetimeengine/src/solutions.py\n",
    "def kerr_metric():\n",
    "    \"\"\"\n",
    "    Description\n",
    "    ===========\n",
    "    Returns Kerr metric.\n",
    "    \"\"\"\n",
    "\n",
    "    # Index configuration for the metric\n",
    "    index_config = \"dd\"\n",
    "    x0, x1, x2, x3 = symbols('x0 x1 x2 x3')\n",
    "    # Reference to the coordiante system.\n",
    "    coordinate_set = [x0, x1, x2, x3]\n",
    "    # Cosmological constant.\n",
    "    cosmological_constant = 0\n",
    "    a, J, M, c, G, r, delt, sigm = symbols('a J M c G r Delta Sigma')\n",
    "    a = (J/(M*c))\n",
    "    rs = (2*G*M/(c**2))\n",
    "    sigm = (x1**2 + (J/(M*c))**2 * cos(x2)**2)\n",
    "    delt = (r**2 - x0 * (2*G*M/(c**2)) + (J/(M*c))**2)\n",
    "    # Metric solution.\n",
    "    metric = Matrix([\n",
    "                                [ (1 - rs * x1 / (x1**2 + (J/(M*c))**2 * cos(x2)**2) ), 0, 0, (2*G*M/(c**2))*x1*(J/(M*c))*sin(x2)**2 / (x1**2 + (J/(M*c))**2 * cos(x2)**2) ], \n",
    "                                [ 0, -1 * ( (r**2 - x0 * (2*G*M/(c**2)) + (J/(M*c))**2) / (x1**2 + (J/(M*c))**2 * cos(x2)**2) ), 0, 0 ], \n",
    "                                [ 0, 0, -1 * (x1**2 + (J/(M*c))**2 * cos(x2)**2), 0 ],\n",
    "                                [ (2*G*M/(c**2))*x1*(J/(M*c))*sin(x2)**2 / (x1**2 + (J/(M*c))**2 * cos(x2)**2), 0, 0, -1 * (x1**2 + (J/(M*c))**2 + (rs*x1*(J/(M*c))**2/(x1**2 + (J/(M*c))**2 * cos(x2)**2))*sin(x2))*sin(x2) ]\n",
    "                            ])\n",
    "\n",
    "    # An array detailing the solution.\n",
    "    solution_array = [ metric, coordinate_set, index_config, cosmological_constant ]\n",
    "    return solution_array"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "# kerr = build_ga_from_solution(kerr_metric())\n",
    "# FIXME takes too long"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
